package com.yang.service.adminimpl;

import com.yang.bean.bj.vo.*;
import com.yang.mapper.UserMapper;
import com.yang.service.admin.StatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @description: TOOD
 * @return:
 * @author: BaoZi
 * @date: 2022/9/8
 */
@Service
public class StatServiceImpl implements StatService {

    @Autowired
    UserMapper userMapper;


    @Override
    public MarketUserVO queryUser() {
        List<UserRowsVO> list = userMapper.selectUser();
        MarketUserVO marketUserVO = new MarketUserVO();
        String[] arrays = new String[2];
        arrays[0] = "day";
        arrays[1] = "users";
        marketUserVO.setColumns(arrays);
        marketUserVO.setRows(list);
        return marketUserVO;
    }

    @Override
    public MarketOrdersVO queryOrder() {

        List<OrderRowsVO> list = userMapper.selectOrder();
        MarketOrdersVO marketOrdersVO = new MarketOrdersVO();
        String[] arrays = new String[5];
        arrays[0] = "day";
        arrays[1] = "orders";
        arrays[2] = "customers";
        arrays[3] = "amount";
        arrays[4] = "pcr";
        marketOrdersVO.setColumns(arrays);
        marketOrdersVO.setRows(list);
        return marketOrdersVO;
    }

    @Override
    public MarketGoodsVO queryGoods() {
        List<GoodsRowsVO> list = userMapper.selectGoods();
        MarketGoodsVO marketGoodsVO = new MarketGoodsVO();
        String[] arrays = new String[4];
        arrays[0] = "day";
        arrays[1] = "orders";
        arrays[2] = "products";
        arrays[3] = "amount";
        marketGoodsVO.setColumns(arrays);
        marketGoodsVO.setRows(list);
        return marketGoodsVO;

    }
}
